﻿using System;
using System.ComponentModel;

namespace Epic.ComponentServices
{
    partial class ExpandableAttributeProvider : TypeDescriptionProvider
    {
        partial class ExpandableAttributeTypeDescriptor : CustomTypeDescriptor
        {
            private class ExpandableAttributePropertyDescriptor : PropertyDescriptor
            {
                private PropertyDescriptor mBaseDescriptor;

                public ExpandableAttributePropertyDescriptor(PropertyDescriptor baseDescriptor, params Attribute[] attributes)
                    : base(baseDescriptor, attributes)
                {
                    mBaseDescriptor = baseDescriptor;
                }

                #region Implementing abstract methods based on the base descriptor, and they just work!

                public override bool CanResetValue(object component)
                {
                    return mBaseDescriptor.CanResetValue(component);
                }
                public override Type ComponentType
                {
                    get
                    {
                        return mBaseDescriptor.ComponentType;
                    }
                }
                public override object GetValue(object component)
                {
                    return mBaseDescriptor.GetValue(component);
                }
                public override bool IsReadOnly
                {
                    get
                    {
                        return mBaseDescriptor.IsReadOnly;
                    }
                }
                public override Type PropertyType
                {
                    get
                    {
                        return mBaseDescriptor.PropertyType;
                    }
                }
                public override void ResetValue(object component)
                {
                    mBaseDescriptor.ResetValue(component);
                }
                public override void SetValue(object component, object value)
                {
                    mBaseDescriptor.SetValue(component, value);
                }
                public override bool ShouldSerializeValue(object component)
                {
                    return mBaseDescriptor.ShouldSerializeValue(component);
                }

                #endregion

            }
        }
    }
}
